import webspider.mysql.mysql as mysql
from webspider.settings import MYSQL_TB

def create_table():
    sql = """
            CREATE TABLE {}(
             id int primary key auto_increment,
             positionName CHAR(72) NOT NULL,
             company CHAR(72) NOT NULL ,
             salary CHAR(32) NOT NULL,
             location CHAR(72),
             release_time CHAR(32),
             work_exp Char(32),
             edu_background CHAR(32),
             company_nature CHAR(32),
             company_scale CHAR(32),
             url CHAR(104))
            """.format(MYSQL_TB)

    with mysql.DB(host='localhost', user='root', passwd='123456', db='51job') as db:
        db.execute(sql)


create_table()
